<!DOCTYPE html>
<html class="ui-page-login">

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>登录</title>
		<link href="css/mui.min.css" rel="stylesheet" />
		<link href="css/style.css" rel="stylesheet" />
		<link href="css/reg_style.css" rel="stylesheet" />
		<link rel="stylesheet" type="text/css" href="css/common.css"/>
		<style>
			.logo-logined {
				width: 0.75rem;
				height: 0.75rem;
				margin: 0.55rem auto 0 auto;
				border: 1px solid #FFF;
				border-radius: 50%;
			}
			
			.logo-title {
				display: inline-block;
				margin: 0.15rem auto 0.89rem auto;
				font-size: 0.2rem;
				width: 100%;
				color: #4D4D4D;
			}
			.mui-input-row label{
				padding-left: 0px;
				text-align: left;
				width: 12%;
			}
			.mui-input-row label~input, .mui-input-row label~select, .mui-input-row label~textarea{
				width: 88%;
			}
			.link-area.register{
				font-size: 0.15rem;
			}
		</style>

	</head>

	<body>
		<div class="mui-content">
			<div class="mui-content-padded content-box">
				<img class="logo-logined" id='logo-logined' src="img/qq.png" />
				<h3 class="logo-title"></h3>
				<form id='login-form' class="mui-input-group">
					<div class="mui-input-row" style="display:none;">
						<label><img class="input_logo_account" src="img/zh.png" /></label>
						<input maxlength="11" id='account' pattern="\d*" type="number" class="mui-input-clear mui-input">
					</div>
					<div class="mui-input-row">
						<label><img class="input_logo_password" src="img/mm.png" /></label>
						<input onkeyup="judge_phone()" maxlength="16" id='password' type="password" data-input-password="2" class="mui-input-clear  mui-input-password" placeholder="请输入密码">
					</div><!-- -->
				</form>
				<div class="link-area forgetPassword blue">
					<a id='forgetPassword' href="reg_user_find.html">忘记密码?</a>
				</div>
				<button id='btn_login' onclick="user_login();" class="mui-btn mui-btn-block mui-btn-primary" style="width: 110%;margin-left: -5%;">登录</button>
				<div class="link-area register">
					<span id='register' onclick="btn_menus_more();" style="color: #007aff;">更多</span>
				</div>
			</div>
			<div class="mui-content-padded oauth-area">

			</div>
		</div>
		<div id="menus_more" class="mui-popover mui-popover-bottom mui-popover-action ">
			<!-- 可选择菜单 -->
			<ul class="mui-table-view">
				<li class="mui-table-view-cell">
					<span onclick="storage_clear();">切换账号</span>
				</li>
				<li class="mui-table-view-cell">
					<a href="reg_user_find.html">找回密码</a>
				</li>
				<li class="mui-table-view-cell">
					<a href="reg_user_join.html">注册</a>
				</li>
			</ul>
			<!-- 取消菜单 -->
			<ul class="mui-table-view">
				<li class="mui-table-view-cell">
					<a href="#menus_more"><b>取消</b></a>
				</li>
			</ul>
		</div>

		<script src="js/mui.min.js"></script>
		<script src="js/mui.enterfocus.js"></script>
		<script src="js/app.js"></script>
		<script src="js/jquery.js"></script>
		<script type="text/javascript" src="js/jsencrypt.js"></script>
		<script src="js/md5.js"></script>
		<script src="js/crypto-js.js"></script>
		<script type="text/javascript" src="js/common.js"></script>
		<script>
			mui.ready(function() {
				//读取登录信息
				var id = storage["id"];
				var avatar = storage["avatar"];
				if(id != null) {
					if(id.length == 11) {
						mui("#account")[0].value = id;
						mui(".logo-title")[0].innerText = id;
					}
					if(avatar.length > 0) {
						mui('#logo-logined')[0].src = avatar;
					}
				}else{
					window.location.href="reg_user_login.html";
				}

				//判断手机号长度，是否正确
				//judge_phone();
			});

			function btn_menus_more() {
				mui("#menus_more").popover('toggle');
			}

			function storage_clear() {
				window.localStorage.clear();//这次是要全部清空缓存的
				window.location.href = "reg_user_login.html";
			}

			//判断手机号长度，是否正确
			function judge_phone() {
				var account = mui('#account')[0].value;
				var password = mui('#password')[0].value;

				if(account.length == 11 && password.length > 0) {
					document.getElementById("btn_login").disabled = false;
					btn_login_se('jianbian3_shengse',"#btn_login");
				} else {
					document.getElementById("btn_login").disabled = true;
					btn_login_se('jianbian1_qianse',"#btn_login");
				}

			}

			//登录前的参数对象RSA加密
			function user_login() {
				var sbx = {};
				sbx.id = mui("#account")[0].value;
				sbx.password = mui("#password")[0].value;
				sbx.password = md5(sbx.password);
				sbx.password = sbx.password.toLowerCase();
				


				login_encrypt_md5(sbx);
				console.log(sbx);
				ajax_submit_before(url_host + 'user/login', 'user_login');

			}
		</script>
	</body>

</html>